package com.example.demo.service.serviceimpl;


import com.example.demo.dao.UserDao;
import com.example.demo.dao.daoimpl.UserDaoImpl;
import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    UserDao userDao=new UserDaoImpl();

    @PostConstruct
    public void init(){
        this.userDao=new UserDaoImpl();
    }

    @Override
    public User selectUserByMessage(String account, String password) {
        return userDao.selectUserByMessage(account,password);
    }

    @Override
    public void saveUser(String account, String password) {
        userDao.saveUser(account,password);
    }

    @Override
    public User selectUserByAccount(String account) {
        return userDao.selectUserByAccount(account);
    }

    @Override
    public void editUser(User user) {
        userDao.editUser(user);
    }

    @Override
    public void uploadPassword(User user) {
        userDao.uploadPassword(user);
    }

}
